package com.legendshop.oa.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

/**
 * 记录每个操作的名称
 *
 */
public class HandlerInterceptor extends HandlerInterceptorAdapter {//此处一般继承HandlerInterceptorAdapter适配器即可  
	
	/** The log. */
	private final Logger log = LoggerFactory.getLogger(HandlerInterceptor.class);
	
    @Override  
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
      // log.debug("executing action  -------> {}" , request.getRequestURI()  + "   =  "+ handler);  
        return true;  
    }  
    
    @Override  
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {  
//    	  log.info("executing action postHandle  ------->  {}", request.getRequestURI());  
    }  
    
    @Override  
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    	//  log.debug("executing action afterCompletion -------> {} " , request.getRequestURI());  
    }  
}  